<?php
/**
 * 初始化安装数据
 */

// 不选择安装数据时不执行sql文件
if (isset($_GET['is_install_db']) && $_GET['is_install_db']) {
    if (is_file(APPSPATH.'Module/Config/App.php')) {
        $rt = \Phpcmf\Service::M('app')->install('module');
        if ($rt['code']) {
            \Phpcmf\Service::M('module', 'module')->install('news', null, 0, 1);
            $sql = file_get_contents(MYPATH.'Config/demo.sql');
            if ($sql) {
                $sql = str_replace('{dbprefix}', \Phpcmf\Service::M()->prefix, $sql);
                \Phpcmf\Service::M()->query_all($sql);
            }
        }
    }
}
//标签调用
if (is_file(APPSPATH.'Mbdy/Config/App.php')) {
    \Phpcmf\Service::M('app')->install('mbdy');
}

//19 导航
/*if (is_file(APPSPATH.'Daohang/Config/App.php')) {
    \Phpcmf\Service::M('module', 'module')->install('daohang');
}*/
//Dever工具
if (is_file(APPSPATH.'Dever/Config/App.php')) {
    \Phpcmf\Service::M('app')->install('dever');
}
//Member 会员
if (is_file(APPSPATH.'Member/Config/App.php')) {
    \Phpcmf\Service::M('app')->install('member');
}
//4Pay 支付
if (is_file(APPSPATH.'Pay/Config/App.php')) {
    \Phpcmf\Service::M('app')->install('pay');
}
//5积分 scorelog
if (is_file(APPSPATH.'Scorelog/Config/App.php')) {
    \Phpcmf\Service::M('app')->install('scorelog');
}
//6会员 / huiyuan huiyuan
if (is_file(APPSPATH.'Huiyuan/Config/App.php')) {
    \Phpcmf\Service::M('app')->install('huiyuan');
}
//7评论 / comment
if (is_file(APPSPATH.'Comment/Config/App.php')) {
    \Phpcmf\Service::M('app')->install('comment');
}
//9 表单 / mform
if (is_file(APPSPATH.'Mform/Config/App.php')) {
    \Phpcmf\Service::M('app')->install('mform');
}
//10 圈子 / quan
if (is_file(APPSPATH.'Quan/Config/App.php')) {
    \Phpcmf\Service::M('app')->install('quan');
}
// 知识 / zhishi
if (is_file(APPSPATH.'Zhishi/Config/App.php')) {
    \Phpcmf\Service::M('app')->install('zhishi');
}
//11 通知 / notice
if (is_file(APPSPATH.'Notice/Config/App.php')) {
    \Phpcmf\Service::M('app')->install('notice');
}

//18 经验值 / explog
if (is_file(APPSPATH.'Explog/Config/App.php')) {
    \Phpcmf\Service::M('app')->install('explog');
}
//24 开关 / fstatus
if (is_file(APPSPATH.'Fstatus/Config/App.php')) {
    \Phpcmf\Service::M('app')->install('fstatus');
}
//25 海报 / haibao
if (is_file(APPSPATH.'Haibao/Config/App.php')) {
    \Phpcmf\Service::M('module', 'module')->install('haibao');
}
//25 用户 / u
if (is_file(APPSPATH.'U/Config/App.php')) {
    \Phpcmf\Service::M('module', 'module')->install('u');
}
//36 微信 / weixin
if (is_file(APPSPATH.'Weixin/Config/App.php')) {
    \Phpcmf\Service::M('app')->install('weixin');
}
//41 百度编辑器 / ueditor
if (is_file(APPSPATH.'Ueditor/Config/App.php')) {
    \Phpcmf\Service::M('app')->install('ueditor');
}
// 60 消息通知 / duixin
if (is_file(APPSPATH.'Duixin/Config/App.php')) {
    \Phpcmf\Service::M('app')->install('duixin');
}
// 问答 / wenda
if (is_file(APPSPATH.'Wenda/Config/App.php')) {
    \Phpcmf\Service::M('app')->install('wenda');
}
// 内容维护工具 / ctool
if (is_file(APPSPATH.'Ctool/Config/App.php')) {
    \Phpcmf\Service::M('app')->install('ctool');
}
// 短信 / duanxin
if (is_file(APPSPATH.'Duanxin/Config/App.php')) {
    \Phpcmf\Service::M('app')->install('duanxin');
}
// 导航
if (is_file(APPSPATH.'Daohang/Config/App.php')) {
    \Phpcmf\Service::M('app')->install('daohang');
}
// 手册 shouce
if (is_file(APPSPATH.'Shouce/Config/App.php')) {
    \Phpcmf\Service::M('app')->install('shouce');
}
//创业金 Chuangyejin
if (is_file(APPSPATH.'Chuangyejin/Config/App.php')) {
    \Phpcmf\Service::M('app')->install('chuangyejin');
}
//活动 Huodong
if (is_file(APPSPATH.'Huodong/Config/App.php')) {
    \Phpcmf\Service::M('app')->install('huodong');
}
//圈群 Quanqun
if (is_file(APPSPATH.'Quanqun/Config/App.php')) {
    \Phpcmf\Service::M('app')->install('quanqun');
}
//赞助 zanzhu
if (is_file(APPSPATH.'Zanzhu/Config/App.php')) {
    \Phpcmf\Service::M('app')->install('zanzhu');
}